package simulator;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class Card {
	static Logger log = Logger.getLogger(Card.class.getName());
	private String name = null;
	private int value = 0;
	private int type = 0;
	private boolean isMoveable = false;
	private boolean isFront = false;
	private Card previousCard = null;
	private Spider domain = null;
	private Point point = null;

	public Card(String name, Spider domian) {
		super();
		PropertyConfigurator.configure("log4j.properties");
		this.type = new Integer(name.substring(0, 1)).intValue();
		this.value = new Integer(name.substring(2)).intValue();
		this.name = name;
		this.domain = domain;
	}

	public void setLocation(Point point) {

		this.point = point;
	}

	public Point getLocation() {
		if (this.point != null) {
			return this.point;

		} else {
			log.debug("the point has not been initiated.");
			throw new NullPointerException();
		}

	}
 
	

	public boolean isMoveable() {
		return isMoveable;
	}

	public void setMoveable(boolean isMoveable) {
		this.isMoveable = isMoveable;
	}

	public boolean isFront() {
		return isFront;
	}

	public void setFront(boolean isFront) {
		this.isFront = isFront;
	}

	public int getValue() {
		return value;
	}

	public int getType() {
		return type;
	}

	public String getName() {
		return name;
	}
	
	@Override
	public String toString() {
		
		// TODO Auto-generated method stub
		return this.getName()+"@"+this.getLocation();
	}

}
